package com.blackfish.handler;

import java.io.IOException;

import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

import com.jfinal.kit.JsonKit;
import com.jfinal.plugin.redis.Redis;

@ServerEndpoint("/websocket")
public class WebSocketController {

    
	@OnOpen
	public void onOpen(Session session) {
		System.out.print("WenSocket Open!!!!\n");
	}

	@OnClose
	public void onClose(Session session) {
		System.out.print("WenSocket Close!!!!\n");
	}

	@OnMessage
	public void onMessage(String requestJson, Session session) {
		try {
			session.getBasicRemote().sendText(requestJson);
		} catch (IOException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
	}
}